<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <jsp:include page="/inc/head.jsp"/>
    <title>教师管理</title>
</head>
<body>
<jsp:include page="/inc/top.jsp"/>
<div class="container">
    <jsp:include page="inc.jsp"/>
    <table class="table table-bordered table-striped table-hover">
        <thead>
        <tr>
            <td colspan="7">
                <form class="form-inline" action="" id="searchForm" method="get" style="padding-bottom: 0px;margin: 0px">
                    <input type="hidden" value="1" name="pageIndex" id="pageIndex"/>
                    <div class="form-group">
                        <label>姓名:</label>
                        <input type="text" class="form-control" value="${searchT.name}" name="name" placeholder="输入教师姓名">
                    </div>
                    <div class="form-group">
                        <label>手机:</label>
                        <input type="text" class="form-control" value="${searchT.mobile}" name="mobile" placeholder="输入手机号码">
                    </div>
                    <div class="form-group">
                        <label>部门:</label>
                        <select name="depId" class="form-control">
                            <option value="0">选择部门</option>
                            <c:forEach items="${deps}" var="dep">
                                <c:if test="${dep.id==searchT.depId}">
                                    <option value="${dep.id}" selected>${dep.name}</option>
                                </c:if>

                                <c:if test="${dep.id!=searchT.depId}">
                                    <option value="${dep.id}">${dep.name}</option>
                                </c:if>
                            </c:forEach>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </td>
        </tr>
        <tr>
            <td>教师标识</td>
            <td>教师名称</td>
            <td>教师编号</td>
            <td>手机</td>
            <td>薪水</td>
            <td>所在部门</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${datas.data}" var="teacher">
            <tr>
                <td>${teacher.id}</td>
                <td>${teacher.name}</td>
                <td>${teacher.tno}</td>
                <td>${teacher.mobile}(${teacher.dep.phone})</td>
                <td>${teacher.salary}</td>
                <td>${teacher.dep.name}</td>
                <td>
                    <a href="javascript:confirmOp('<%=request.getContextPath()%>/admin/teacher?m=delete&id=${teacher.id}','删除教师对象不可逆，确定删除${teacher.id}吗?')" class="btn btn-danger">删除</a>
                    <a href="<%=request.getContextPath()%>/admin/teacher?m=update&id=${teacher.id}" class="btn btn-warning">更新</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
        <jsp:include page="/inc/pager.jsp"/>
    </table>
</div>
</body>
</html>
